<%@ page contentType="text/html;charset=UTF-8" language="java"  import="java.util.*" trimDirectiveWhitespaces="true" %>
<%@include file="/WEB-INF/pages/common/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>商品管理</title>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <%@include file="/WEB-INF/pages/common/commonCss.jsp"%>
  <link rel="stylesheet" href="${basePath}/resources/css/uniform.css" />
  <link rel="stylesheet" href="${basePath}/resources/css/select2.css" />
  <link rel="stylesheet" href="${basePath}/resources/css/matrix-style.css" />
  <link rel="stylesheet" href="${basePath}/resources/css/matrix-media.css" />
  <link rel="stylesheet" href="${basePath}/resources/css/admin/list.css" />

</head>
<style>
  /*.modal {*/
    /*left: 10%;*/
    /*width: 80%;*/
     /*margin-left:0;*/
  /*}*/
  /*.form-horizontal .control-label {*/
    /*margin-right: 1rem;*/
  /*}*/
  /*input{*/
    /*width: 60%;*/
  /*}*/
</style>
<body>

<!--Header-part-->
<%@include file="/WEB-INF/pages/common/head.jsp"%>


<!--sidebar-menu-->
<%@include file="/WEB-INF/pages/common/left.jsp"%>

<div id="content">
  <div id="content-header">
    <div id="breadcrumb">
      <a href="${adminPath}/index" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> 首页</a>
      <a href="#" class="current">平台商品管理</a>
    </div>
    <%--<h1>平台商品管理</h1>--%>
  </div>

  <div class="container-fluid">

    <hr>
    <div class="row-fluid">
      <div class="span12">


        <div class="widget-box">
          <div class="widget-title"> <span class="icon"><i class="icon-th"></i></span>
            <h5 style="padding: 4px;">
              <%--<a href="#myModal"  class="btn btn-primary" data-toggle="modal"><i class="icon-plus" style="padding-right: 0.2rem"></i>新增</a>--%>
              <a href="javascript:void(0)"  onclick="good.add()" class="btn btn-primary" ><i class="icon-plus" style="padding-right: 0.2rem"></i>新增</a>
            </h5>
            <a style="float: right;margin-top: 0.2rem" onclick="tzAdmin.search()" class="btn btn-success"><i class="icon-search icon-white"></i></a>

            <label style="float:right;margin-top:0.2rem">
              <input type="text" style="width: inherit" id="keywords" aria-controls="DataTables_Table_0" placeholder="输入查询关键字">
            </label>

          </div>
          <div class="widget-content nopadding">
            <table class="table table-bordered data-table">
              <thead>

              <tr>
                <th>主键</th>
                <th>主图</th>
                <th>商品编号</th>
                <th>标题 <span class="up"></span> <span class="down"></span></th>
                <th>原价（元）</th>
                <%--<th>现价（元）</th>--%>
                <th>库存总数</th>
                <th>创建时间</th>
                <%--<th>删除状态</th>--%>
                <th>操作</th>
              </tr>
              </thead>
              <tbody id="tbody" data-model="shop/good">
                  <tr>
                    <td id="loading" colspan="50"></td>
                  </tr>


              </tbody>
               <tfoot>

               </tfoot>
            </table>
            <div class="cpage"></div>

          </div>
        </div>
      </div>
    </div>
  </div>


  <!-- Modal -->


</div>



   <!--Footer-part-->
<%@include file="/WEB-INF/pages/common/footer.jsp"%>

<!--end-Footer-part-->

<%@include file="/WEB-INF/pages/common/commonJS.jsp"%>
   <script type="text/javascript" src="${basePath}/resources/sg/tz_page.js"></script>
   <%--<script src="${basePath}/resources/js/jquery.ui.custom.js"></script>--%>
<script src="${basePath}/resources/js/bootstrap.min.js"></script>
<%--<script src="${basePath}/resources/js/jquery.uniform.js"></script>--%>
<script src="${basePath}/resources/js/select2.min.js"></script>
<script src="${basePath}/resources/js/jquery.dataTables.min.js"></script>
<script src="${basePath}/resources/js/matrix.js"></script>
<%--<script src="${basePath}/resources/js/matrix.tables.js"></script>--%>

   <script>
       $(function(){
         tzAdmin.loadData(0,10,function(itemCount){
           tzAdmin.initPage(itemCount);//分页加载一次吗
         });
       });


     var good = {
          delete:function (obj) {
              $.tzConfirm({title:"友情提示",content:"您确定删除吗?",callback:function(ok){
                  if(ok){
                      var $this = $(obj);
                      var opid = $this.data("opid");
                      var model = $("#tbody").data("model");
                      clearTimeout(this.timer);
                      var params = {};
                      params["id"] = opid;
                      this.timer = setTimeout(function(){
                          alert(adminPath+"/"+model+"/delete");
                          loading("请稍后数据执行中...");
                          $.ajax({
                              type:"post",
                              url:adminPath+"/"+model+"/delete",
                              data:params,
                              success:function(data){
                                  loading("执行成功...",3);
                                  $this.parents("tr").remove();
                                  var len = $("#tbody").find("tr").length;
                                  if(len==0){
                                      //window.location.href =window.location.href;
                                      tzAdmin.loadData(0,10,function(itemCount){
                                          tzAdmin.initPage(itemCount);//分页加载一次吗
                                      });
                                  }
                              }
                          });
                      },200);
                  }
              }});
          },
          add:function () {
              localStorage.removeItem('hfl_catogories');
              window.location.href = adminPath +"/shop/good/add";
          },
          edit:function (obj,goodId) {
             localStorage.removeItem('hfl_catogories');
             window.location.href = adminPath +"/shop/good/edit/"+goodId;
          }

     };
   </script>

</body>
</html>
